Munching Squares

Charlie Veniot 17th December 2022 at 12:02am
' Based on the FreeBASIC program found at https://rosettacode.org/wiki/Munching_squares#FreeBASIC
' This BASIC Anywhere Machine mod by Charlie Veniot

Dim As Long x, y, r, w = 256

screen _newimage( w, w, 32 )

do
  For L = 1 to 3
  _display
  For x = 0 To w -1
      For y = 0 To w -1
          r =(x Xor y) And 255
  		    select case L
		      case 1
              PSet(x, y), _RGB(r, r , r)       ' gray scale
		      case 2
              PSet(x, y), _RGB(r, 255 - r, 0 + r)  ' purple + green
			   case 3
              PSet(x, y), _RGB(r, 0, 0)        ' red
		    end select
      Next
	   _display
  Next
  _display
  _delay 4
  Next
loop